import http from '../api';

export default (state, action) => {
    state = state || {
        commentInfoData: []
    };
    switch (action.type) {
        case 'GET_COMMENT_INFO':
            return {
                commentInfoData: action.commentInfoData
            }
        default:
            return state;
    }
}

export const getCommentInfo = (blogId) => (dispatch) => {
    const data = {
        blogId: blogId
    }
    http.blog.commentInfo(data).then(res => {
        dispatch({
            type: 'GET_COMMENT_INFO',
            commentInfoData: res.data
        })
    })
}
